package com.entor.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.entor.dao.CocsDaoI;
import com.entor.dao.PriveDaoI;
import com.entor.model.Cocs;
import com.entor.model.Msg;
import com.entor.model.Prive;
import com.entor.util.StringUtil;
@Service
public class PriveService  implements BaseServiceI<Prive>{

	@Autowired
	private PriveDaoI pdi;
	@Autowired
	private CocsDaoI cdi;
	
	public List<Prive> find(Prive t) {
		List<Prive> list = pdi.find(t);
		return list;
	}
	
	public String getCode(String code){
		Cocs p = new Cocs();
		p.setCode(code);
		p.setBir(" order by to_number(code) desc");
		List<Cocs> list = cdi.find(p);
		if(list.size()>0){
			p = list.get(0);
			String str = (Integer.parseInt(p.getCode().replace(code, ""))+1)+"";
			code += StringUtil.addChar(str, '0', 6);
		}else{
			code = code + "000001";
		}
		return code;
	}

	public Prive get(Prive t) {
		// TODO Auto-generated method stub
		return null;
	}

	public Msg insert(Prive t) {
		// TODO Auto-generated method stub
		return null;
	}

	public Msg batchInsert(String objs) {
		// TODO Auto-generated method stub
		return null;
	}

	public Msg edit(Prive t) {
		// TODO Auto-generated method stub
		return null;
	}

	public Msg remove(Integer id) {
		// TODO Auto-generated method stub
		return null;
	}

	public Msg batchRemove(String ids) {
		// TODO Auto-generated method stub
		return null;
	}

}
